<!DOCTYPE html>
<html>
<head>
    <title>订单</title>
		<#include "/header.html">
            <link href="${request.contextPath}/statics/css/bootstrap-datetimepicker.min.css" rel="stylesheet" />
        </head>
<body>
<div id="rrapp" v-cloak>
    <div v-show="showList">

        <div class="grid-btn">

            <#if shiro.hasPermission("sys:orders:save")>
                <a class="btn btn-success" @click="add"><i class="fa fa-plus"></i>&nbsp;录入出货单</a>
            </#if>
            <#if shiro.hasPermission("sys:orders:update")>
                <a class="btn btn-warning" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;编辑／查看</a>
            </#if>
            <a class="btn btn-success" @click="download"><i class="fa fa-pencil-square-o"></i>&nbsp;下载对账单</a>

        </div>

        <div class="grid-btn" style="margin-top: 20px">
                <div class="form-group col-sm-2">
                    <input type="text" v-model="searcher.orderNo" class="form-control" placeholder="订单号">
                </div>
                <div class="form-group col-sm-2">
                    <input type="text" v-model="searcher.datetimeStart" id="datetimeStart" class="form-control" placeholder="开始时间">
                </div>
                <div class="form-group col-sm-2">
                    <input type="text" v-model="searcher.datetimeEnd" id="datetimeEnd" class="form-control" placeholder="结束时间">
                </div>
                <div class="form-group col-sm-2 ">
                    <input type="text" v-model="searcher.userName" class="form-control" placeholder="业务员">
                </div>
                <div class="form-group col-sm-2">
                    <input type="text" v-model="searcher.shopName" class="form-control" placeholder="采购商">
                </div>
                <a class="btn btn-primary" @click="query">查询</a>
        </div>


        <table id="jqGrid"></table>
        <div id="jqGridPager"></div>
    </div>

    <div v-show="orderAdd" class="panel panel-default">
        <div class="panel-heading">{{title}}</div>
        <form class="form-horizontal" style="width: 85%">

            <div class="form-group">
                <div class="col-sm-6 control-label">
                    <span id="errorMsg" style="color: red"></span>
                </div>

            </div>


            <div class="form-group">
                <div class="col-sm-2 control-label">订单类型:</div>
                <label class="radio-inline">
                    <input type="radio" name="type" value="0" v-model="orders.type"/> 出货单
                </label>
                <label class="radio-inline">
                    <input type="radio" name="type" value="1" v-model="orders.type"/> 进货单
                </label>
            </div>

            <div class="form-group">
                <div class="col-sm-2 control-label">产品名称（编号）:</div>
                <div class="col-sm-7">
                    <input  type="hidden" v-model = "product.id"/>

                    <input id="searchString" v-model="searchString" class="form-control" type="text" placeholder="产品名称（编号）" autocomplete="off" />
                </div>

                <input type="button" class="btn btn-primary" @click="orderTmpAdd" value="出库"/>
            </div>

            <div id="orderItem" style="display: block">
            </div>

            <hr>

            <div class="form-group">
                <div class="col-sm-2 control-label">采购商</div>
                <div class="col-sm-10">
                    <select class="form-control" v-model="orders.shopId">
                        <option v-for="supplier in supplierList" v-bind:value="supplier.id">
                            {{ supplier.name }}
                        </option>
                    </select>
                </div>
            </div>


            <div class="form-group">
                <div class="col-sm-2 control-label">业务员</div>
                <div class="col-sm-10">
                    <select class="form-control" v-model="orders.userId">
                        <option v-for="user in userList" v-bind:value="user.userId">
                            {{ user.username }}
                        </option>
                    </select>
                </div>
            </div>


            <div class="form-group">
                <div class="col-sm-2 control-label">运费: </div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" v-model="orders.logisticsFee" placeholder="运费"/>
                </div>
            </div>

            <div class="form-group">
                <div class="col-sm-2 control-label">总价: </div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" readonly  v-model="orders.totalPrice" placeholder="总价"/>
                </div>
            </div>

            <div class="form-group">
                <div class="col-sm-2 control-label">备注: </div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" v-model="orders.remark" placeholder="备注"/>
                </div>
            </div>

            <div class="form-group">
                <div class="col-sm-2 control-label"></div>
                <input type="button" class="btn btn-primary" @click="saveOrUpdate" value="下单"/>
                &nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
                &nbsp;&nbsp;<input type="button" class="btn btn-primary" @click="preview" value="打印预览"/>

            </div>
        </form>
    </div>

</div>

<script src="${request.contextPath}/statics/libs/datetimepicker/bootstrap-datetimepicker.js?_${.now?long}"></script>
<script src="${request.contextPath}/statics/libs/datetimepicker/bootstrap-datetimepicker.zh-CN.js?_${.now?long}"></script>
<script src="${request.contextPath}/statics/libs/bootstrap-typeahead.js?_${.now?long}"></script>
<script src="${request.contextPath}/statics/js/modules/sys/orders.js?_${.now?long}"></script>
</body>
</html>